package from;

import org.apache.wicket.markup.html.WebPage;
import org.apache.wicket.markup.html.form.ChoiceRenderer;
import org.apache.wicket.markup.html.form.Form;
import org.apache.wicket.markup.html.form.IChoiceRenderer;

import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

public class CheckBoxMultipleChoice extends WebPage {
    private static List SITES = new ArrayList();
    private static Map NAMES = new HashMap();

    static {
        SITES.add("http://aa.com");
        SITES.add("http://bb.com");
        SITES.add("http://cc.com");

        NAMES.put("http://aa.com", "aa");
        NAMES.put("http://bb.com", "bb");
        NAMES.put("http://cc.com", "cc");
    }


    public CheckBoxMultipleChoice(){
        super();

        Form form = new Form("formM");
        this.add(form);

        IChoiceRenderer renderer = new ChoiceRenderer(){
            public Object getDisplayValue(Object o){
                return NAMES.get(o);
            }
        };

        org.apache.wicket.markup.html.form.CheckBoxMultipleChoice siteChoice
                = new org.apache.wicket.markup.html.form.CheckBoxMultipleChoice("sites", SITES,renderer);
        form.add(siteChoice);
    }
}
